<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('实验报告管理列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
<!--                            <li>-->
<!--                                <label>关联实验项目ID：</label>-->
<!--                                <input type="text" name="classProjectId"/>-->
<!--                            </li>-->
<!--                            <li>-->
<!--                                <label>关联学生ID：</label>-->
<!--                                <input type="text" name="studentId"/>-->
<!--                            </li>-->
                            <li>
                                <label>报告标题：</label>
                                <input type="text" name="reportTitle"/>
                            </li>
                            <li>
                                <label>提交时间：</label>
                                <input type="text" class="time-input" placeholder="请选择提交时间" name="submitTime"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="college:report:add">
                    <i class="fa fa-plus"></i> 添加
                </a>
                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="college:report:edit">
                    <i class="fa fa-edit"></i> 修改
                </a>
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="college:report:remove">
                    <i class="fa fa-remove"></i> 删除
                </a>
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="college:report:export">
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('college:report:edit')}]];
        var removeFlag = [[${@permission.hasPermi('college:report:remove')}]];
        var prefix = ctx + "college/report";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "实验报告管理",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'reportId',
                    title: '报告ID',
                    visible: false
                },
                {
                    field: 'classProjectId',
                    title: '关联实验项目ID',
                    visible: false
                },
                {
                    field: 'semesterId',
                    title: '关联学期ID',
                    visible: false
                },
                {
                    field: 'semesterName',
                    title: '学期'
                },
                {
                    field: 'courseId',
                    title: '课程ID',
                    visible: false
                },
                {
                    field: 'courseName',
                    title: '课程'
                },
                {
                    field: 'projectId',
                    title: '实验项目ID',
                    visible: false
                },
                {
                    field: 'projectName',
                    title: '实验项目'
                },
                {
                    field: 'classId',
                    title: '班级ID',
                    visible: false
                },
                {
                    field: 'className',
                    title: '班级'
                },

                {
                    field: 'studentId',
                    title: '关联学生ID',
                    visible: false
                },
                {
                    field: 'studentName',
                    title: '学生'
                },
                {
                    field: 'reportTitle',
                    title: '报告标题'
                },
                {
                    field: 'reportContent',
                    title: '报告内容',
                    visible: false
                },
                {
                    field: 'filePath',
                    title: '报告附件路径',
                    formatter: function(value) {
                        if (!value || value === '') return '-';
                        var html = '';
                        var paths = value.split(',');
                        paths.forEach(function(path) {
                            var fileName = path.substring(path.lastIndexOf('/') + 1);
                            html += '<a href="' + [[${@config.getKey("ruoyi.upload.url")}]] + path + '" target="_blank">' + fileName + '</a><br>';
                        });
                        return html;
                    }
                },
                {
                    field: 'submitTime',
                    title: '提交时间'
                },
                {
                    field: 'score',
                    title: '成绩'
                },
                {
                    field: 'comment',
                    title: '评语'
                },
                {
                    field: 'reviewTime',
                    title: '批阅时间'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.reportId + '\')"><i class="fa fa-edit"></i>批阅实验报告</a> ');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });
    </script>
</body>
</html>